package cn.exrick.xboot.modules.content.serviceimpl;

import cn.exrick.xboot.modules.content.dao.HontPermissionDao;
import cn.exrick.xboot.modules.content.entity.HontPermission;
import cn.exrick.xboot.modules.content.service.HontPermissionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * 权限接口实现
 * @author Exrick
 */
@Slf4j
@Service
@Transactional
public class HontPermissionServiceImpl implements HontPermissionService {

    @Autowired
    private HontPermissionDao hontPermissionDao ;
    @Override
    public HontPermissionDao getRepository() {
        return hontPermissionDao;
    }

    @Override
    public List<HontPermission> findByLevelOrderBySortOrder(Integer level) {

        return hontPermissionDao.findByLevelOrderBySortOrder(level);
    }

    @Override
    public List<HontPermission> findByParentIdOrderBySortOrder(String parentId) {

        return hontPermissionDao.findByParentIdOrderBySortOrder(parentId);
    }

    @Override
    public List<HontPermission> findByTypeAndStatusOrderBySortOrder(Integer type, Integer status) {

        return hontPermissionDao.findByTypeAndStatusOrderBySortOrder(type, status);
    }

    @Override
    public List<HontPermission> findByTitle(String title) {

        return hontPermissionDao.findByTitle(title);
    }

    @Override
    public List<HontPermission> findByTitleLikeOrderBySortOrder(String title) {

        return hontPermissionDao.findByTitleLikeOrderBySortOrder(title);
    }

    @Override
    public List<HontPermission> findFirstLevel() {
        List<HontPermission> firstLevel = hontPermissionDao.findFirstLevel();
        return firstLevel;
    }

    @Override
    public List<HontPermission> findByParentId(String parentId) {
        List<HontPermission> byParentId = hontPermissionDao.findByParentId(parentId);
        return byParentId;
    }
}